package cn.wiseda.finance.services;

import java.util.List;

import javax.annotation.Resource;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.stereotype.Component;
import org.springframework.transaction.annotation.Transactional;

import cn.wiseda.finance.dao.OrganDao;
import cn.wiseda.finance.entity.Organization;

@Component
@Transactional
public class OrganServices {

	private static final Logger log = LoggerFactory.getLogger("OrganServices");

	@Resource
	private OrganDao organDao;

	public boolean saveOrgan(Organization organ) {
		log.info("插入组织机构" + organ.getName());
		boolean flag = organDao.saveOrgan(organ);
		return flag;
	}

	public List<Organization> getOrganList() {
		log.info("获取组织机构列表");
		List<Organization> organList = organDao.getOrganList();
		return organList;
	}
	
	public Organization getOrgan(int id){
		log.info("获取组织机构，代码："+id);
		return organDao.getOrgan(id); 
	}
	
	public boolean modifyOrgan(Organization organ) {
		return organDao.modifyOrgan(organ);
	}
}
